require("../../@babel/runtime/helpers/Arrayincludes"), Component({
    properties: {
        marTop: {
            type: String,
            default: "0"
        },
        pkgItem: {
            type: Array,
            default: []
        }
    },
    data: {
        animationData: {},
        showMore: !1,
        showDialog: !1,
        selectObj: {
            choseTagA: !1,
            choseTagB: !1,
            suitSex: "0103",
            suitMarried: "0203",
            min: -1,
            max: 1 / 0,
            pkgItemIds: []
        },
        pkgItemIds: [],
        conditionList: [ {
            tag: "A",
            title: "适用人群",
            list: [ {
                id: 1,
                text: "男士",
                flag: !1,
                suitSex: "0102",
                suitMarried: "0203"
            }, {
                id: 2,
                text: "女未婚",
                flag: !1,
                suitSex: "0101",
                suitMarried: "0202"
            }, {
                id: 3,
                text: "女已婚",
                flag: !1,
                suitSex: "0101",
                suitMarried: "0201"
            } ]
        }, {
            tag: "B",
            title: "套餐价格",
            list: [ {
                id: 1,
                text: "300以下",
                flag: !1,
                min: 0,
                max: 300
            }, {
                id: 2,
                text: "300~1000",
                flag: !1,
                min: 300,
                max: 1e3
            }, {
                id: 3,
                text: "1000~1500",
                flag: !1,
                min: 1e3,
                max: 1500
            }, {
                id: 4,
                text: "1500~3000",
                flag: !1,
                min: 1500,
                max: 3e3
            }, {
                id: 5,
                text: "3000以上",
                flag: !1,
                min: 3e3,
                max: 1 / 0
            } ]
        }, {
            tag: "C",
            title: "体检项目（多选）",
            list: []
        } ]
    },
    methods: {
        show: function(t) {
            this.setData({
                showDialog: !0
            }), this.getHeight(), this.reSetData(t);
        },
        getHeight: function() {
            var t = this;
            wx.getSystemInfo({
                success: function(i) {
                    var e = i.windowHeight - 55;
                    t.setData({
                        clientHeight: e
                    });
                }
            });
        },
        hide: function() {
            this.setData({
                showDialog: !1
            });
        },
        _closeTap: function() {
            this.hide();
        },
        reSetData: function(t) {
            if (t) {
                for (var i = this.data.conditionList, e = 0; e < i.length; e++) for (var a = 0; a < i[e].list.length; a++) "A" == i[e].tag ? 1 == t.choseTagA && i[e].list[a].suitSex == t.suitSex && i[e].list[a].suitMarried == t.suitMarried ? i[e].list[a].flag = !0 : i[e].list[a].flag = !1 : "B" == i[e].tag && (1 == t.choseTagB && i[e].list[a].min === t.min && i[e].list[a].max === t.max ? i[e].list[a].flag = !0 : i[e].list[a].flag = !1);
                this.setData({
                    conditionList: i,
                    selectObj: t
                });
            }
        },
        _cellTap: function(t) {
            var i = t.currentTarget.dataset.tag, e = t.currentTarget.dataset.item, a = t.currentTarget.dataset.idx, s = this.data.conditionList;
            if ("C" == i) {
                var n = this.data.pkgItemIds;
                n.includes(e.id) ? n = n.filter(function(t) {
                    return t != e.id;
                }) : n.push(e.id), this.setData({
                    pkgItemIds: n
                });
            } else {
                for (var r = 0; r < s.length; r++) if (s[r].tag == i) for (var l = 0; l < s[r].list.length; l++) if (l == a) {
                    var g = s[r].list[l].flag;
                    s[r].list[l].flag = !g;
                } else s[r].list[l].flag = !1;
                this.setData({
                    conditionList: s
                });
            }
        },
        _rightMoreTap: function() {
            this.setData({
                showMore: !this.data.showMore
            });
        },
        _replacement: function() {
            for (var t = this.data.conditionList, i = 0; i < t.length; i++) for (var e = 0; e < t[i].list.length; e++) t[i].list[e].flag = !1;
            var a = {
                choseTagA: !1,
                choseTagB: !1,
                suitSex: "0103",
                suitMarried: "0203",
                min: -1,
                max: 1 / 0
            };
            this.setData({
                pkgItemIds: [],
                conditionList: t,
                selectObj: a
            });
        },
        _determine: function() {
            for (var t = this.data.selectObj, i = this.data.conditionList, e = 0; e < i.length; e++) {
                for (var a = !1, s = 0; s < i[e].list.length; s++) if (1 == i[e].list[s].flag) {
                    "A" == i[e].tag ? (t.suitSex = i[e].list[s].suitSex, t.suitMarried = i[e].list[s].suitMarried) : "B" == i[e].tag && (t.min = i[e].list[s].min, 
                    t.max = i[e].list[s].max), a = !0;
                    break;
                }
                "A" == i[e].tag ? t.choseTagA = a : "B" == i[e].tag && (t.choseTagB = a);
            }
            t.pkgItemIds = this.data.pkgItemIds, this.setData({
                selectObj: t
            }), this.triggerEvent("updateCondtionsSelect", t);
        }
    },
    lifetimes: {
        attached: function() {}
    }
});